package facilius.controller.action.alunocurso;

import facilius.model.ServiceLocator;
import facilius.model.pojo.Usuario;
import java.util.HashMap;
import java.util.Map;
import org.mentawai.core.BaseAction;

/**
 *
 * @author Graciano
 */
public class AlunoCursoShowFormAction extends BaseAction{

    @Override
    public String execute() throws Exception {
        String consequence = ERROR;
        try {
            Long id = input.getLong("id");
            Usuario aluno = ServiceLocator.getUsuarioService().readById(id);
            output.setValue("nome", aluno.getNome());
            Map<String,Object> criteria = new HashMap<String,Object>();
            criteria.put("options", true);
            criteria.put("usuarioId", aluno.getId());
            output.setValue("cursoOptions", ServiceLocator.getCursoService().getOptions(criteria));
            consequence = SUCCESS;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return consequence;
    }



}
